struct Solution {}

fn main() {}

impl Solution {
    pub fn is_power_of_two(n: i32) -> bool {
        if n < 1 {
            return false;
        }
        let mut n_copy = n;
        while n_copy > 1 {
            if n_copy % 2 != 0 {
                return false;
            }
            n_copy /= 2;
        }
        true
    }
}